package com.tanjun.userservice.apiservice.api;

import com.tanjun.common.constants.ServiceConstant;
import com.tanjun.common.model.R;
import com.tanjun.userservice.apiservice.response.adminrole.admin.AdminRoleResponse;
import com.tanjun.userservice.apiservice.response.adminuser.admin.AdminUserBaseResponse;
import com.tanjun.userservice.apiservice.response.adminuser.api.AdminUserResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

import static com.tanjun.common.constants.UrlConstant.URL_AUTH.OPEN;
import static com.tanjun.common.constants.UrlConstant.URL_USER.INNER;

@FeignClient(name = ServiceConstant.USER_SERVICE,contextId = "adminUser")
public interface AdminUserApi {
    @GetMapping(INNER+"/adminUser"+OPEN+"/getAdminBaseInfoByKey")
    R<AdminUserBaseResponse> getAdminBaseInfoByKey(@RequestParam(value = "key") String key);

    /**
     * 根据用户id获取用户信息
     * @param userId 用户id
     * @return 用户信息
     */
    @GetMapping(INNER+"/adminUser"+OPEN+"/getUserInfoById")
    R<AdminUserResponse> getUserBaseInfo(@RequestParam(value = "userId") Long userId);

    /**
     * 根据用户id获取角色
     * @param userId 用户id
     * @return 返回角色信息
     */
    @GetMapping(INNER+"/adminUser"+OPEN+"/getUserRoles")
    R<List<AdminRoleResponse>> getUserRoles(@RequestParam(value = "userId")Long userId);


}
